home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_11_02 / 1102107a < prev    next >
Text File  |  1992-12-02  |  774b  |  41 lines

  1. void new_pivot(void)
  2. {
  3.     int i,j;
  4.  
  5.     /* calculate the new pipvot equation */
  6.     for (j=0; j<COLUMNS; j++) {
  7.         table[leave_pos][j] = 
  8.           table[leave_pos][j]/pivot_element;
  9.     }
  10. }
  11.  
  12. void new_equation(void)
  13. {
  14.  
  15.     int i,j;
  16.  
  17.     float enter_coef;
  18.     float new_pivot;
  19.     float new_pivot_equ;
  20.  
  21.     /* calculate all the non-pivot EQUATIONS */
  22.     for (i=0;i<=ROWS;i++) {
  23.        enter_coef = -table[i][enter_pos];
  24.  
  25.        /* if the pivot coefficient is zero, 
  26.           or if this is the leaving equation, 
  27.           skip */
  28.        if ( (i == leave_pos) 
  29.         || (enter_coef == 0) ) 
  30.            continue;
  31.        for (j=0; j<COLUMNS; j++) {
  32.           new_pivot = table[leave_pos][j];
  33.           new_pivot_equ = new_pivot*enter_coef;
  34.           table[i][j] = 
  35.         table[i][j] + new_pivot_equ;
  36.        }
  37.     }
  38. }
  39.  
  40.  
  41.